﻿using M.ShopMachine.Domain;
using M.ShopMachine.Read.WebApi.Application.Command.MaintainCommand;
using M.ShopMachine.Repository.Interface;
using MediatR;

namespace M.ShopMachine.Read.WebApi.Application.Handler.MaintainHandler
{
    public class GetTableMainTainHandler : IRequestHandler<GetTableMaintainCommand, List<Maintain>>
    {
        private readonly IMaintainRepository maintainRepository;

        public GetTableMainTainHandler(IMaintainRepository maintainRepository)
        {
            this.maintainRepository = maintainRepository;
        }

        public async Task<List<Maintain>> Handle(GetTableMaintainCommand request, CancellationToken cancellationToken)
        {
            return await maintainRepository.GetTableMaintainAsync(request.id);
        }
    }
}
